package my.app.timer;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayer.OnInitializedListener;
import com.google.android.youtube.player.YouTubePlayer.Provider;
import com.google.android.youtube.player.YouTubePlayerSupportFragment;
import com.google.android.youtube.player.YouTubePlayerView;

public class YoutubeFrag extends YouTubePlayerSupportFragment 
{
	static private final String DEVELOPER_KEY = "AIzaSyCXdnrTcWO7k0mvLd9YNliYmrCQ5mCxRMU";
    static private final String VIDEO = "U2HSam9whDI";
    static private final String PLAYLIST = "PLMu1yl6cQMHz51JvpcXiOBPVCsdbZ65sj";

@Override
public void onCreate(Bundle arg0) {
	// TODO Auto-generated method stub
	super.onCreate(arg0);
}
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    	View rootView = inflater.inflate(R.layout.youtube_layout,container, false);
    	
    	YouTubePlayerView ytView=(YouTubePlayerView) rootView.findViewById(R.id.youtube_view);
    	ytView.initialize(DEVELOPER_KEY,(OnInitializedListener) this);
    	return rootView;
    }

	public void onInitializationFailure(Provider provider,
			YouTubeInitializationResult error) {
		// TODO Auto-generated method stub
		
	}

	public void onInitializationSuccess(Provider provider,
			YouTubePlayer player, boolean wasRestored) {
		//player.loadPlaylist(PLAYLIST);
        player.loadVideo(VIDEO);
		
	}
    
    
	
	
}
